﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Framework;

namespace Enterprise.Handle
{
    public partial class AddCandidates : FrontBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            object result;
            try
            {
                string post = Fq("CoPost").SafeToString();
                string workExperience = Fq("CoWorkExperience").SafeToString();
                string education = Fq("CoEducation").SafeToString();
                string age = Fq("CoAge").SafeToString();
                DateTime date = DateTime.Now;
                string language = Fq("CoLanguage").SafeToString();
                string email = Fq("CoEmail").SafeToString();
                string name = Fq("CoName").SafeToString();
                bool isRead = Fq("CoIsRead").SafeToBool();
                string mobile = Fq("CoMobile").SafeToString();
                string qq = Fq("CoQq").SafeToString();
                string phone = Fq("CoPhone").SafeToString();
                string summary = Fq("CoSummary").SafeToString();
                string identNumber = Fq("CoIdentNumber").SafeToString();
                string workHistory = Fq("CoWorkHistory").SafeToString();
                string sex = Fq("CoSex").SafeToString();
                var candidatesService = new CandidatesService();
                candidatesService.Add(post, workExperience, education, age,
                                       date, language, email, name,
                                       mobile, qq, phone, summary, identNumber,
                                       workHistory, sex, isRead);
                result = new { state = true, message = "应聘资料提交成功，等待管理员审核！" };
            }
            catch (Exception ex)
            {
                result = new { state = false, message = ex.Message };
            }
            Json(result);
        }
    }
}